using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations.Schema;
using SalesPages.DomainModel;

namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class SiteVersionMap : EntityTypeConfiguration<SiteVersion>
    {
        public SiteVersionMap()
        {
            // Primary Key
            this.HasKey(t => t.VersionId);

            // Properties
            this.Property(t => t.VersionId)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.VersionName)
                .HasMaxLength(30);

            this.Property(t => t.VersionValue)
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("SiteVersion");
            this.Property(t => t.VersionId).HasColumnName("VersionId");
            this.Property(t => t.VersionName).HasColumnName("VersionName");
            this.Property(t => t.VersionValue).HasColumnName("VersionValue");
        }
    }
}
